package cn.llyong.rpc.common.bo;


import com.baidu.bjf.remoting.protobuf.annotation.ProtobufClass;

import java.io.Serializable;
import java.util.List;

/**
 * @description:
 * @author: lvyong
 * @date: 2020年06月22日 11:14
 */
@ProtobufClass
public class RpcRequest implements Serializable {
    private static final long serialVersionUID = 1L;

    private String requestId;
    private String appName;
    private String serviceItf;
    private String methodName;
    private List<Param> data;

    public RpcRequest() {
    }

    public String getRequestId() {
        return requestId;
    }

    public void setRequestId(String requestId) {
        this.requestId = requestId;
    }

    public String getAppName() {
        return appName;
    }

    public void setAppName(String appName) {
        this.appName = appName;
    }

    public String getServiceItf() {
        return serviceItf;
    }

    public void setServiceItf(String serviceItf) {
        this.serviceItf = serviceItf;
    }

    public String getMethodName() {
        return methodName;
    }

    public void setMethodName(String methodName) {
        this.methodName = methodName;
    }

    public List<Param> getData() {
        return data;
    }

    public void setData(List<Param> data) {
        this.data = data;
    }

    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder("{");
        sb.append("\"requestId\":\"")
                .append(requestId).append('\"');
        sb.append(",\"appName\":\"")
                .append(appName).append('\"');
        sb.append(",\"serviceItf\":\"")
                .append(serviceItf).append('\"');
        sb.append(",\"methodName\":\"")
                .append(methodName).append('\"');
        sb.append(",\"data\":")
                .append(data);
        sb.append('}');
        return sb.toString();
    }

    @ProtobufClass
    public static class Param {
        private String type;
        private String data;

        public Param() {
        }

        public String getType() {
            return type;
        }

        public void setType(String type) {
            this.type = type;
        }

        public String getData() {
            return data;
        }

        public void setData(String data) {
            this.data = data;
        }

        @Override
        public String toString() {
            final StringBuilder sb = new StringBuilder("{");
            sb.append("\"type\":\"")
                    .append(type).append('\"');
            sb.append(",\"data\":\"")
                    .append(data).append('\"');
            sb.append('}');
            return sb.toString();
        }
    }
}

